﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Configuration.Provider;
using Formsy.Common;
using System.IO;

namespace Formsy.Providers.FileSystem
{
    public abstract class FileSystemProvider : ProviderBase
    {
        public abstract List<FormsyFile> Save(string formName, int entryId, List<FormsyFile> files, string folderPath);

        public virtual void CreateFolder(string folderPath)
        {
            DirectoryInfo folder = new DirectoryInfo(folderPath);
            if (!folder.Exists)
                folder.Create();
        }
    }


    public class FileSystemProviderCollection : ProviderCollection
    {
        // Return an instance of DataProvider
        // for a specified provider name
        new public FileSystemProvider this[string name]
        {
            get { return (FileSystemProvider)base[name]; }
        }
    }
}

